 #include <mpi.h>
 #include <stdio.h>
 #include <string.h>
 
 #define BUFSIZE 50001
 #define TAG 0
 
 int main(int argc, char *argv[])
 {
   char buff[BUFSIZE];
   int numprocs;
   int myid;
   int i;
   double StartTime, EndTime;
   MPI_Status stat;
 
   MPI_Init(&argc,&argv); 
   MPI_Comm_size(MPI_COMM_WORLD,&numprocs); 
   MPI_Comm_rank(MPI_COMM_WORLD,&myid); 
 
   if(myid == 0)
   {
     StartTime = MPI_Wtime();
     for(i=1;i<100000;i++)
     {
       sprintf(buff, "HelloHello");
       MPI_Send(buff, 50000, MPI_CHAR, 1, TAG, MPI_COMM_WORLD);
     }
     EndTime = MPI_Wtime();
     printf("Time %lf\n",EndTime-StartTime);
   }
   else if (myid == 1)
   {
     for(i=1;i<100000;i++) {
     MPI_Recv(buff, 50000, MPI_CHAR, 0, TAG, MPI_COMM_WORLD, &stat);
     }
   }
 
   MPI_Finalize(); 
   return 0;
 }
